<template>
  <!--坟墓-->
  <div class="tomb">
    <image
      :class="[imgSize + '-img']"
      v-for="(tomb, index) in tombs"
      :key="index"
      :src="require('@/assets/images/unit/tomb.png')"
      @click="operationTomb(tomb)"
      :style="{
        top: $appHelper.getPosition(tomb.row),
        left: $appHelper.getPosition(tomb.column),
      }"
    />
  </div>
</template>

<script>
import baseVar from "@/mixins/frame/baseVar.js";
import eventype from "../../manger/eventType";
export default {
  mixins: [baseVar],
  methods: {
    // 鼠标点击坟墓
    operationTomb(tomb) {
      if (this.$appHelper.mapCanClick()) {
        // 点击了其他的单位 或者已经行动过了
        this.$appHelper.sendEvent(eventype.CLICK_TOMB, tomb);
      }
    },
  },
  computed: {
    tombs() {
      return this.$store.getters.game.tomb_list;
    },
  },
};
</script>

<style lang="scss" scoped>
.tomb image {
  position: absolute;
}
</style>